//
//  MCLotteryHallViewController.m
//  TLYL
//
//  Created by miaocai on 2017/6/1.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCLotteryHallViewController.h"
#import "MCPickNumberViewController.h"
#import "MCUserDefinedLotteryCategoriesViewController.h"
#import "MCHomePageLotteryCategoriesView.h"
#import "MCHomePagePictrueCycleView.h"
#import "MCHomePageInfoCycleView.h"
#import "MCPickNumberViewController.h"
#import "MCLotteryID.h"
#import "MCCZTXView.h"
#import "MCUserDefinedLotteryCategoriesModel.h"

@interface MCLotteryHallViewController ()<MCHomePageLotteryCategoriesDelegate>

@property(nonatomic,weak)MCHomePageLotteryCategoriesView *lotteryView;

@end

@implementation MCLotteryHallViewController
#pragma mark-life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"天利娱乐";
    [self setUpUI];
 
}
#pragma mark-setUpUI
- (void)setUpUI{
    self.view.backgroundColor = RGB(218, 218, 218);
    CGFloat naviHeight = 64;
    CGFloat picCycleHeight = MC_REALVALUE(150);
    MCHomePageLotteryCategoriesView *lotteryView = [[MCHomePageLotteryCategoriesView alloc] initWithFrame:CGRectMake(0, naviHeight + picCycleHeight + MC_REALVALUE(80), G_SCREENWIDTH, G_SCREENHEIGHT - naviHeight - picCycleHeight - MC_REALVALUE(80))];
    lotteryView.delegate=self;
    _lotteryView=lotteryView;
    __weak MCLotteryHallViewController *weakSelf = self;
    lotteryView.collectionViewDidSelectedCallBack = ^(MCUserDefinedLotteryCategoriesModel *model){
        
    MCPickNumberViewController *pickVC =  [[MCPickNumberViewController alloc] init];
    pickVC.lotteriesTypeModel = model;
    [weakSelf.navigationController pushViewController:pickVC animated:YES];
    };
    lotteryView.collectionViewDidSelectedAddBtnCallBack = ^{
    MCUserDefinedLotteryCategoriesViewController * vc = [[MCUserDefinedLotteryCategoriesViewController alloc]init];
   
    [weakSelf.navigationController pushViewController:vc animated:YES];

    };
    [self.view addSubview:lotteryView];
    MCHomePagePictrueCycleView *picView = [[MCHomePagePictrueCycleView alloc] initWithFrame:CGRectMake(0, naviHeight, G_SCREENWIDTH, picCycleHeight)];
    [self.view addSubview:picView];
    MCHomePageInfoCycleView *infoView = [[MCHomePageInfoCycleView alloc] initWithFrame:CGRectMake(0, picCycleHeight + naviHeight, G_SCREENWIDTH, MC_REALVALUE(30))];
    [self.view addSubview:infoView];

    MCCZTXView *cztxView = [[MCCZTXView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(infoView.frame) + 1, G_SCREENWIDTH, MC_REALVALUE(45))];
    [self.view addSubview:cztxView];
    UIButton *btn = [[UIButton alloc] init];
    [btn setImage:[UIImage imageNamed:@"kefu"] forState:UIControlStateNormal];
    btn.frame = CGRectMake(0, 0, MC_REALVALUE(30), MC_REALVALUE(30));
    btn.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
    [btn addTarget:self action:@selector(contactCustomerServiceBtnClick:) forControlEvents:UIControlEventTouchDown];
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    self.navigationItem.rightBarButtonItem = rightItem;
}
#pragma mark-touch event 
- (void)contactCustomerServiceBtnClick:(UIButton *)btn{
    
}
/*
 * 跳转自定义彩种
 */
#pragma mark-MCHomePageLotteryCategoriesDelegate
-(void)SetUserDefinedLotteryCategories{
    MCUserDefinedLotteryCategoriesViewController * vc = [[MCUserDefinedLotteryCategoriesViewController alloc]init];
    __block MCLotteryHallViewController * weakSelf = self;
    vc.block=^(NSMutableArray<MCUserDefinedLotteryCategoriesModel *> *marr){
        
        [weakSelf.lotteryView relayOutUI];
        
    };
    
    [self.navigationController pushViewController:vc animated:YES];

}
@end
